<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>图书管理</title>
	<%@ include file="/pages/common/base_js_jq.jsp"%>
	<script type="text/javascript">
		$(function () {
			$(".del").click(function () {
				var name =$(this).parent().parent().parent().find("td:first").text();
				return confirm("你确定要删除《"+name+"》吗？")
            });
        });
	</script>
</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="static/img/logo.gif" >
			<span class="wel_word">图书管理系统</span>
		<%@ include file="/pages/common/manager_head.jsp"%>
	</div>
	
	<div id="main">
		<table>
			<tr>
				<td></td>
				<td>名称</td>
				<td>价格</td>
				<td>作者</td>
				<td>销量</td>
				<td>库存</td>
				<td colspan="2">操作</td>
			</tr>
			<c:forEach items="${requestScope.book}" var="book">
			<tr>
				<%--<td><input type="checkbox" name="" value="${book.id}"></td>--%>
				<td>${book.name}</td>
				<td>${book.price}</td>
				<td>${book.author}</td>
				<td>${book.sales}</td>
				<td>${book.stock}</td>
				<td>
					<form action="selectBookById" method="get">
						<input name="id" value="${book.id}" type="hidden">
						<input type="submit" value="修改">
					</form>
				</td>
				<%--<td><a href="BookServlet?action=getBook&id=${book.id}&action=update&pageNum=${page.pageNum}">修改</a></td>--%>
				<td>
					<form action="deletedBook" method="post">
						<input type="hidden" name="_method" value="delete">
						<input name="id" value="${book.id}" type="hidden">
						<input class="del" type="submit" value="删除">
					</form>
				</td>
				<%--<td><a class="del" href="BookServlet?action=delete&id=${book.id}&pageNum=${page.pageNum}">删除</a></td>--%>
			</tr>
			</c:forEach>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td><a href="bookType">添加图书</a></td>
			</tr>	
		</table>
		<%@ include file="/pages/common/url.jsp"%>
	</div>

	<%@ include file="/pages/common/footer_all.jsp"%>
</body>
</html>